package cn.zero.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

@Entity
@Table(name = "t_wechatInfo", indexes = {@Index(name = "appid_userId" ,columnList="appid,userId", unique = true)})
public class WechatInfo implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4265479661267405454L;
	@EmbeddedId
	private WechatInfo_ID id;
	private Long userId;
	private Date createTime;

	public WechatInfo() {
		this.id = new WechatInfo_ID();
		this.createTime = new Date();
	}

	public WechatInfo(String unionid, String openid, String appid) {
		this();
		this.id.setOpenid(openid);
		this.id.setAppid(appid);
	}

	public WechatInfo_ID getId() {
		return id;
	}

	public void setId(WechatInfo_ID id) {
		this.id = id;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

}
